﻿
@{
}

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <style type="text/css">
        body, html, #allmap {
            width: 100%;
            height: 100%;
            overflow: hidden;
            margin: 0;
            font-family: "微软雅黑";
        }
        .outDiv {
            width: 48%;
            height: 100%;
            margin-left: 12px;
            border: 1px solid #DDDDDD;
            float: left;
        }
        .lableName {
            width: 100px;
            height: 36px;
            padding-left: 10px;
            margin-left: -6px;
            margin-top: 10px;
            background-color: #20789E;
            color: #ffffff;
            line-height: 36px;
        }
        .IframeClass {
            border-width: 0;
            width: 100%;
            height: 90%;
        }
        .btnDiv {
            width: 100%;
            height: 4%
        }
        #submit {
            border: 0px;
            background-color: #20789E;
            border-radius: 5px;
            width: 80px;
            height: 26px;
            float: right;
            margin-right: 20px;
            margin-top: 5px;
            color: #ffffff;
        }

    </style>   
    <title>调整订单</title>
</head>
<body>
    <div class="btnDiv">
        <button type="button" id="submit" onclick="OrderChangeSubmit()">
            <i class="icon iconfont icon-baocun"></i>
            <span>保存</span>
        </button>
    </div>
    <div style="width:100%; height:90%">
        <div class="outDiv">
            <div class="lableName">待调整任务</div>
            <iframe src="/Plat/Grid/GridView?GridCode=Grid201811010949430001" class="IframeClass" id="iFrameLeft"></iframe>
        </div>
        <div class="outDiv">
            <div class="lableName">新订单</div>
            <iframe src="/Plat/Grid/GridView?GridCode=Grid201811010930290001" class="IframeClass" id="iFrameRight"></iframe>
        </div>
    </div>

</body>
</html>
<script type="text/javascript" src="../../Plat/Flow/lib/jquery-ui-1.8.4.custom/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="../../Plat/Grid/OrderChange.js"></script>
<script type="text/javascript">
  

    function OrderChangeSubmit() {
        debugger
       // var newOrder = CPGridGetSelChkData();
        var rSel = window.frames["iFrameLeft"].contentWindow.CPGridGetRadioSelData();
        if (rSel == "") {
            alert("请选择待调整的任务！");
            return false;
        }
        var sSel = window.frames["iFrameRight"].contentWindow.CPGridGetSelChkData();
        if (sSel == "") {
            alert("请选择新订单！");
            return false;
        }
        var url = "/api/OrderChange/SubmitOrderChange";

        var inputObj = new Object();
        inputObj.oldTaskId = rSel;
        inputObj.newOrderIds = sSel;
        inputObj.GridCode = window.frames["iFrameLeft"].contentWindow.CPGridGlobal_GridObj.GridCode;
        inputObj.CurUserId = window.frames["iFrameLeft"].contentWindow.CPCurUserId;
        inputObj.CurUserIden = window.frames["iFrameLeft"].contentWindow.CPCurUserIden;

        $.ajax({
            type: "POST",
            url: url,
            data: JSON.stringify(inputObj),
            contentType: 'application/json',
            success: function (data) {
                if (data.Result === false) {
                    alert("保存失败，详细信息：" + data.ErrorMsg);
                    return false;
                }
                else {
                    taskid = data.ErrorMsg;
                    alert("保存成功！");
                    window.frames["iFrameLeft"].contentWindow.CPGridRefresh();
                    window.frames["iFrameRight"].contentWindow.CPGridRefresh();
                }
            }
        });
    }

    //获取url中的参数
    function  getQueryString(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); // 匹配目标参数
        var result = window.location.search.substr(1).match(reg);  // 对querystring匹配目标参数
        if (result != null) {
            return decodeURIComponent(result[2]);
        } else {
            return null;
        }
    }

</script>